package com.blb.utils;

import lombok.Data;

@Data
public class ResponseEntity {

    private boolean rs = true;
    private String msg = "操作成功";
    private Object data;

    public static ResponseEntity success(){
        return new ResponseEntity();
    }

    public static ResponseEntity success(String msg){
        ResponseEntity entity = new ResponseEntity();
        entity.msg = msg;
        return entity;
    }

    public static ResponseEntity success(Object data){
        ResponseEntity entity = new ResponseEntity();
        entity.data = data;
        return entity;
    }

    public static ResponseEntity success(String msg, Object data){
        ResponseEntity entity = new ResponseEntity();
        entity.msg = msg;
        entity.data = data;
        return entity;
    }

    public static ResponseEntity error(){
        ResponseEntity entity = new ResponseEntity();
        entity.rs = false;
        entity.msg = "操作失败";
        return entity;
    }

    public static ResponseEntity error(String msg){
        ResponseEntity entity = new ResponseEntity();
        entity.rs = false;
        entity.msg = msg;
        return entity;
    }

    public static ResponseEntity error(Object data){
        ResponseEntity entity = new ResponseEntity();
        entity.rs = false;
        entity.data = data;
        return entity;
    }

    public static ResponseEntity error(String msg, Object data){
        ResponseEntity entity = new ResponseEntity();
        entity.rs = false;
        entity.msg = msg;
        entity.data = data;
        return entity;
    }


}
